# 导包
from common.base import *


class Pay(Base):
    # TODO 3 订单支付成功(点击结算订单后操作)
    # 定位余额支付方式
    def balance_pay(self):
        self.click((By.NAME, "payment"))

    # 定位银行汇款按钮
    def card_pay(self):
        self.click((By.XPATH, '//*[@id="paymentTable"]/tbody/tr[3]/td[1]/input'))

    # 定位提交订单按钮
    def commit_order(self):
        # self.click((By.CSS_SELECTOR, ".fl > a"))
        self.click((By.XPATH, '//*[@id="theForm"]/div[15]/div[2]/input[1]'))

    # 获取生成的订单号
    def get_order_number(self):
        return self.get_text((By.XPATH, '/html/body/div[6]/div/h6/font'))

    # 定位我的订单
    def my_order(self):
        self.click((By.LINK_TEXT, "我的订单"))

    # 获取我的订单的状态(已付款/未付款)
    def get_my_order_status(self):
        return self.get_text((By.XPATH, '/html/body/div[6]/div[2]/div/div/div/table/tbody/tr[1]/td[4]'))


